Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: make version output consistent #69

Merged
merged 1 commit into from
Mar 1, 2021
Merged

Conversation

jbrockopp
Copy link
Contributor

Currently when executing the plugin, you'll see output that looks like this:

$ make docker-run

### Executing vela-kubernetes:local image
time="2021-03-01T15:04:07Z" level=info msg="Vela Kubernetes Plugin" code="https://github.com/go-vela/vela-kubernetes" docs="https://go-vela.github.io/docs/plugins/registry/kubernetes" registry="https://hub.docker.com/r/target/vela-kubernetes"
time="2021-03-01T15:04:07Z" level=fatal msg="no config action provided"
{
  "canonical": "v0.2.0",
  "major": 0,
  "minor": 2,
  "patch": 0,
  "metadata": {
    "architecture": "amd64",
    "build_date": "2021-03-01T09:03:49Z",
    "compiler": "gc",
    "git_commit": "32fe344ad5e5fdef5b1cdd243de0647d1b01b20e",
    "go_version": "go1.16",
    "operating_system": "linux"
  }
}
make: *** [docker-run] Error 1

Or like this:

$ make docker-run

### Executing vela-kubernetes:local image
{
  "canonical": "v0.2.0",
  "major": 0,
  "minor": 2,
  "patch": 0,
  "metadata": {
    "architecture": "amd64",
    "build_date": "2021-03-01T09:03:49Z",
    "compiler": "gc",
    "git_commit": "32fe344ad5e5fdef5b1cdd243de0647d1b01b20e",
    "go_version": "go1.16",
    "operating_system": "linux"
  }
}
time="2021-03-01T15:04:07Z" level=info msg="Vela Kubernetes Plugin" code="https://github.com/go-vela/vela-kubernetes" docs="https://go-vela.github.io/docs/plugins/registry/kubernetes" registry="https://hub.docker.com/r/target/vela-kubernetes"
time="2021-03-01T15:04:07Z" level=fatal msg="no config action provided"
make: *** [docker-run] Error 1

The second form of output was the intended behavior when the code was initially written.

This change will ensure that we always output the version information at the very beginning before any other output.

Also, I added a fallback default of v0.0.0 for the semantic tag value we pass to the plugin.

This will help prevent a panic in the event that tag is not set as intended.

@jbrockopp jbrockopp added the enhancement Indicates an improvement to a feature label Mar 1, 2021
@jbrockopp jbrockopp self-assigned this Mar 1, 2021
@codecov
Copy link

codecov bot commented Mar 1, 2021

Codecov Report

Merging #69 (4e15553) into master (32fe344) will decrease coverage by 0.12%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
- Coverage   47.97%   47.84%   -0.13%     
==========================================
  Files           9        9              
  Lines         371      372       +1     
==========================================
  Hits          178      178              
- Misses        191      192       +1     
  Partials        2        2              
Impacted Files Coverage Δ
cmd/vela-kubernetes/main.go 0.00% <0.00%> (ø)

@jbrockopp jbrockopp marked this pull request as ready for review March 1, 2021 15:12
@jbrockopp jbrockopp requested a review from a team as a code owner March 1, 2021 15:12
Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jbrockopp jbrockopp merged commit e32fba7 into master Mar 1, 2021
@jbrockopp jbrockopp deleted the enhance/version/output branch March 1, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates an improvement to a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants